#include <list>
#include "../NetEngine_SourceCode/XyRyNet_Comm.h"
#include "../NetEngine_SourceCode/XyRyNet_Types.h"
#include "../NetEngine_SourceCode/NetEngine_Plugin/NetEngine_PluginCore/PluginCore_Define.h"
#include "../NetEngine_SourceCode/NetEngine_Plugin/NetEngine_PluginCore/PluginCore_Error.h"
#include "../NetEngine_SourceCode/NetEngine_LinuxApi/NetEngine_LinuxSdk/LinuxSdk_Define.h"

//g++ -rdynamic -std=gnu++11 -Wall -g TestFor_Plugin.cpp -o TestFor_Plugin  -L ../NetEngine_Release/NetEngine_Release/NetEngine_Core -L ../NetEngine_Release/NetEngine_Release/NetEngine_PublicLib -L ../NetEngine_Release/NetEngine_Release/NetEngine_Plugin -L ../NetEngine_Release/NetEngine_Release/NetEngine_LinuxApi -lNetEngine_Core -lNetEngine_BaseLib -ldl -lNetEngine_PluginCore -lNetEngine_LinuxSdk -Wl,-rpath=../NetEngine_Release/NetEngine_Release/NetEngine_Core:../NetEngine_Release/NetEngine_Release/NetEngine_PublicLib:../NetEngine_Release/NetEngine_Release/NetEngine_Plugin:../NetEngine_Release/NetEngine_Release/NetEngine_LinuxApi

void PluginCore_Callback(LPCTSTR lpszFile,LPVOID lParam)
{
    printf("%s\n",lpszFile);
}

int main()
{
    LPCTSTR lpszPath = _T(".");
    LPCTSTR lpszPlugin = _T("./libNetEngine_BaseLib.xpl");

    if (!PluginCore_Search_Start(lpszPath,PluginCore_Callback))
    {
        printf("搜索插件失败！");
        return 0;
    }
    if (!PluginCore_FrameWork_Init())
    {
        printf("初始化插件框架失败");
        return 0;
    }
    XNETHANDLE xhNet;
    if (!PluginCore_FrameWork_Push(&xhNet,lpszPlugin))
    {
        printf("添加插件失败！");
        return 0;
    }
    PluginCore_FrameWork_Exec(xhNet);

    if (!PluginCore_FrameWork_Del(xhNet))
    {
        printf("删除插件失败！");
        return 0;
    }
    printf("执行完毕！\n");
    return 0;
}
